<?php
	$tt=TTSK::GetTinTucSuKienTheoMa($_GET['matt']);
?>
<div>
	<span><?php  if(!isset($_GET['result'])) echo $_GET['result'];  ?></span>
	<form  action="php sources/quan ly ttsk/CapNhatTTSK.php" method="post" >
		<input type='hidden' name='matt' <?php echo "value='$tt->mattsk'"; ?> ></input>
    	<fieldset>          
			<table class="bangdangtin">
				<tr class='legend'>
							<td colspan="2" align="center" >Cập nhật tin tức</td>
						</tr>
				  <tr>
						<td id="firstcol">Tiêu đề</td>
						<!-- TODO: checktieude()-->
						<td><textarea id="tieude" name="tieude" required  /><?php echo $tt->tieude; ?></textarea> <!-- required k duoc bo trong-->
					</tr>
					 <tr>
						<td id="firstcol">Vị trí đăng</td>
						<td><select id="capdo" name="capdo">
								<option value="Chi Hội" <?php if($tt->capdo=='Chi Hội') echo "selected"; ?> >Chi hội</option>
								<option value="Liên Chi" <?php if($tt->capdo=='Liên Chi') echo "selected"; ?> >Liên chi</option>
							</select>
						</td>
					  </tr>
					  <tr>
						<td id="firstcol">Thể loại</td>
						<td>
							<select id="theloai" name="theloai" style='width:200px'>
								<?php 
									include("handle/config.php");
									session_start();
									$sql = "SELECT  * FROM THELOAITTSK";
									$result=mysqli_query($con,$sql);
									while($row = mysqli_fetch_array($result))
									if($tt->theloai==$row['MATL'])
										echo '<option value="'.$row['MATL'].'" selected>'.$row['TENTL'].'</option>'; 
									else
										echo '<option value="'.$row['MATL'].'">'.$row['TENTL'].'</option>'; 
									
									?>
							</select>
						</td>
					  </tr>
					<tr>
						<td  valign="top" id="firstcol" required>Nội dung tin</td><td></td>
					</tr>
					<tr>
						<td colspan='2'  ><textarea class="ckeditor" id="noidungTTSK" name="noidungTTSK" rows="20" cols="200"><?php echo $tt->noidung; ?> </textarea></td>
					</tr>
					<tr>
						<td colspan="2" align="right" valign="bottom"><button type="submit" value="Đăng" />Cập nhật</button></td>
					 </tr>
			</table>
                
        </fieldset>
        
    </form> 
	</div>